home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / AGSTUT1.ZIP / AGSTUT1.PPS < prev    next >
Text File  |  1995-03-04  |  5KB  |  143 lines

  1. ;-------------------------------------------------------------PowerPPL v2.1--
  2. ; File           : LIB1.PPS
  3. ; Original by    : LONE RUNNER on 03/04/1995 at 16:37:52
  4. ; Last update by : LONE RUNNER on 03/04/1995 at 18:07:23
  5. ;----------------------------------------------------------------------------
  6. ;
  7. ;$USEFUNCS
  8. ;
  9. ;----------------------------------------------------------------------------
  10. Integer v_int1, v_int2, v_int3, v_int4, v_int5, v_int6, v_int7
  11. String v_str1
  12. ;----------------------------------------------------------------------------
  13. Declare Procedure PrintFade(String v_arg)
  14. Declare Procedure PrintScramble(String v_arg)
  15. Declare Procedure EffCurseur()
  16. Declare Procedure Synchronize()
  17. ;----------------------------------------------------------------------------
  18. Begin
  19.  
  20. Cls
  21. Print "@X0F"
  22. PrintScramble("This is a string printed with the PrintScramble() Procedure")
  23. PrintLn
  24. PrintFade("This is a string printed with the PrintFade() Procedure")
  25.  
  26. End
  27.  
  28.  
  29. ;----------------------------------------------------------------------------
  30. Procedure EffCurseur()
  31. ;
  32. ; This procedure remove the cursor by changing color to 0, printing a space
  33. ; at coordinates (1, 23) and move the cursor back to this position.
  34. ;
  35.  
  36. AnsiPos 1,23
  37. Color 0
  38. Print " "
  39. Backup 1
  40.  
  41. EndProc
  42.  
  43. ;----------------------------------------------------------------------------
  44.  
  45. Procedure Synchronize()
  46. ;
  47. ; This procedure waits for the receiver so the ppe will run exactly at the
  48. ; same speed on the remote screen than on the local screen. This is used to
  49. ; avoid full modem buffers
  50. ;
  51. While (Outbytes() > 0) Do
  52. EndWhile
  53.  
  54. EndProc
  55.  
  56. ;----------------------------------------------------------------------------
  57.  
  58. Procedure PrintFade(String v_arg)
  59. ;
  60. ; This procedure writes a text in color 15 with a fading effect on every 
  61. ; character
  62. ;
  63.  
  64.  
  65. For v_int1 = 1 to len(v_arg)                 ; for each character
  66.     If (Mid(v_arg, v_int1, 1) = " ") Then    ; if this is a space, no fade
  67.         Print "@X0F "
  68.         Continue
  69.     Endif
  70.     Print "@X08" + Mid(v_arg, v_int1, 1)     ; print in color 8
  71.     v_int2 = getX()                          ; backup position
  72.     v_int3 = getY()
  73.     EffCurseur()                             ; remove cursor
  74.     Delay 1                                  ; wait one tick
  75.     AnsiPos v_int2, v_int3                   ; restore position
  76.     Backup 1                                 ; move cursor back 1 char
  77.     Print "@X07" + Mid(v_arg, v_int1, 1)     ; print in color 7
  78.     v_int2 = getX()
  79.     v_int3 = getY()
  80.     EffCurseur()
  81.     Delay 1
  82.     AnsiPos v_int2, v_int3
  83.     Backup 1
  84.     Print "@X0F" + Mid(v_arg, v_int1, 1)     ; print in color 15
  85.     v_int2 = getX()
  86.     v_int3 = getY()
  87.     EffCurseur()
  88.     Delay 1
  89.     Synchronize()                            ; wait for other end
  90.     AnsiPos v_int2, v_int3
  91. Next
  92.  
  93. Endproc
  94.  
  95. ;----------------------------------------------------------------------------
  96.  
  97. Procedure PrintScramble(String v_arg)
  98. ;
  99. ; This procedure writes a string with a random scramble effect
  100. ;
  101.  
  102. v_int4 = getx()     ; backup position
  103. v_int5 = gety()     ;
  104. v_int7 = curcolor() ; backup color
  105.  
  106. v_int2 = len(v_arg) ; length of string -> v_int2
  107.  
  108. While (1) Do
  109.     v_int1 = random(v_int2-1)+1 ; we randomly generate a number depending on
  110.                                 ; v_int2 (witch begins with the string len)
  111.     v_int3 = 0
  112.     v_int6 = 0
  113.     While (1) do                ; do until v_int6 is not v_int1 (random number)
  114.         inc v_int3
  115.         v_str1 = ScrText(v_int4+v_int3-1,v_int5, 1, False)
  116.         if (v_str1 = " ") inc v_int6 ; if char pointed is a space, inc v_int6
  117.         if (v_int6 = v_int1) Break
  118.     Endwhile
  119.     AnsiPos v_int4+v_int3-1,v_int5 ; ok so we have now the nth space (n = random)
  120.     v_str1 = Mid(v_arg, v_int3, 1) 
  121.     if (v_str1 != " ") Then        ; if the char to print is a space, print 
  122.         Print v_str1               ; a char 255, if not, print it...
  123.     else
  124.         Print chr(255)
  125.     endif
  126.     dec v_int2                     ; dec v_int2 so we cannot go over the 
  127.     if (v_int2 = 0) Break          ; amount of spaces available
  128.     EffCurseur()                   ; remove cursor
  129.     Delay 1                        ; add some delay
  130.     Synchronize()                  ; wait for other end
  131.     Color v_int7                   ; restore color
  132. Endwhile
  133.  
  134.  
  135. ; Warning : This procedure NEEDS to find spaces where the string will be
  136. ; printed... if not, a endless loop will occur...
  137. ; To ensure taht everything is ok, you should add a CLS before or someting
  138. ; like :
  139. ; Print Space(len(v_arg))
  140. ; Backup len(v_arg)
  141.  
  142. EndProc
  143.